package Practice.Practice_02.UserManagementSystem;

import java.util.Scanner;

public class Admin{
    public static void adminPage(Person[] person,int index){
        Scanner sc = new Scanner(System.in);
        System.out.println("欢迎登录主窗体");
        System.out.println(person[index].getName() +"您好：" + " " + "您的权限是：" + person[index].getPower());
        System.out.println("=========================");
        while(true){
            System.out.println("添加用户------------------1");
            System.out.println("删除用户------------------2");
            System.out.println("修改用户------------------3");
            System.out.println("查询用户------------------4");
            System.out.println("程序退出------------------5");
            int choice = sc.nextInt();
            switch (choice) {
                case 1:
                    AddUser.add(person);
                    break;
                case 2:
                    DeleteUser.delete(person,index);
                    break;
                case 3:
                    UpdateUser.update(person);
                    break;
                case 4:
                    SearchUser.search(person);

                    break;
                case 5:
                    //System.exit(0);
                    return;
                default:
                    System.out.println("请重新输入！");
            }
        }
    }
}
